'''
Description: 
Version: 2.0
Autor: zyw
Date: 2021-12-31 10:58:55
LastEditors: zyw
LastEditTime: 2022-03-04 15:11:07
'''
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from locator.loginlocator import LoginLocator as loc
from common.base_page import BasePage


class LoginPage(BasePage):
    
    def login(self, username, password, pic_code):
        """登录操作"""
        # # 输入账号
        # self.driver.find_element(*loc.user_loc).send_keys(username)
        # # 输入密码
        # self.driver.find_element(*loc.pwd_loc).send_keys(password)
        # #输入验证码
        # self.driver.find_element(*loc.pic_code_loc).send_keys(pic_code)
        # # 点击登录按钮
        # self.driver.find_element(*loc.login_btn_loc).click()
        # 输入账号
        self.input_send_keys(loc.user_loc,username,'登录界面-账号输入框')
        # 输入密码
        self.input_send_keys(loc.pwd_loc,password,'登录界面-密码输入框')
        #输入验证码
        self.input_send_keys(loc.pic_code_loc,pic_code,'登录界面-验证码输入框')
        # 点击登录按钮
        self.click_element(loc.login_btn_loc,'登录界面-验证码输入框')
        
        
    def get_pop_window_info(self):
        """获取系统弹窗提示信息"""
        element = self.wait_element_visible(loc.pop_window_info_loc,'错误提示弹窗')
        return element.text
        